﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Infrastructure.kflwyg
{
    public class kflwygHelper
    {

        #region 项目信息相关接口

        /// <summary>
        /// 完善项目信息
        /// </summary>
        public string ImproveProject(ImproveProjectParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/service_join/improve_project";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;

        }

        //http://localhost:9609/api/1.0/service_join/get_improve_project?project_code=475000200630007167

        /// <summary>
        /// 获取项目完善信息
        /// </summary>
        public void GetImproveProject(string projectCode)
        {

            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/service_join/improve_project?project_code={projectCode}";
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Get(url));
            if (resutData.code != 200)
            {

            }
        }

        #endregion


        #region 参建单位信息相关接口

        /// <summary>
        /// 上传项目参建单位信息
        /// </summary>
        public string AddProjectSub(AddProjectSubParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/project_sub_contractor/add";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }


        /// <summary>
        /// 修改项目参建单位信息
        /// </summary>
        public string UpdateProjectSub(AddProjectSubParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/project_sub_contractor/update";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// 删除项目参建单位信息
        /// </summary>
        public string DeleteProjectSub(string projectCode, string corpCode)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/project_sub_contractor/delete";

            string postData = JsonConvert.SerializeObject(new { project_code = projectCode, corp_code = corpCode });
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }


        /// <summary>
        /// 查询项目参建单位信息
        /// http://localhost:9609/api/1.0/project_sub_contractor/query?page_num=1&page_size=10&project_code=475000200706008652&corp_code=
        /// </summary>
        /// <param name="page_num">当前页码。从1开始</param>
        /// <param name="page_size">每页记录数，最多不能超过50</param>
        /// <param name="project_code">项目编码</param>
        /// <param name="corp_code">参建企业统一社会信用代码</param>
        public void GetImproveProject(string page_num, string page_size, string project_code, string corp_code)
        {

            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/project_sub_contractor/query?page_num={page_num}&page_size={page_size}&project_code={project_code}&corp_code={corp_code}";
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Get(url));
            if (resutData.code != 200)
            {

            }
        }

        #endregion


        #region 班组信息相关接口

        /// <summary>
        /// 上传班组信息
        /// </summary>
        public string AddTeam(AddTeamParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/team/add";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }


        /// <summary>
        /// 修改项目参建单位信息
        /// </summary>
        public string UpdateTeam(AddProjectSubParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/team/update";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// 删除项目参建单位信息
        /// </summary>
        public string DeleteTeam(string projectCode, string corpCode, string teamName)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/team/delete";

            string postData = JsonConvert.SerializeObject(new { project_code = projectCode, corp_code = corpCode, team_name = teamName });
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// 查询项目参建单位信息
        /// http://localhost:9609/api/1.0/team/query?page_num=1&page_size=5&project_code=475000200706008652&corp_code=&team_name=
        /// </summary>
        /// <param name="page_num">当前页码。从1开始</param>
        /// <param name="page_size">每页记录数，最多不能超过50</param>
        /// <param name="project_code">项目编码</param>
        /// <param name="corp_code">参建企业统一社会信用代码</param>
        /// <param name="team_name">班组名称</param>
        public void GetTeam(string page_num, string page_size, string project_code, string corp_code, string team_name)
        {

            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/team/query?page_num={page_num}&page_size={page_size}&project_code={project_code}&corp_code={corp_code}&team_name={team_name}";
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Get(url));
            if (resutData.code != 200)
            {

            }
        }

        #endregion


        #region 工人信息相关接口

        #region 基本信息

        /// <summary>
        /// 上传项目工人信息
        /// http://localhost:9609/api/1.0/project_worker/add
        /// </summary>
        public string AddProjectWorker(AddProjectWorkerParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/project_worker/add";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// 修改项目工人信息
        /// http://localhost:9609/api/1.0/project_worker/update
        /// </summary>
        public string UpdateProjectWorker(AddProjectWorkerParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/project_worker/update";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }


        /// <summary>
        /// 删除项目工人信息
        /// http://localhost:9609/api/1.0/project_worker/delete
        /// </summary>
        /// <param name="project_code">"475000200706008652</param>
        /// <param name="corp_code">91130826MA07RT7E9A</param>
        /// <param name="team_name">园林班组</param>
        /// <param name="idcard_number">410203197403075639</param>
        /// <returns></returns>
        public string DeleteProjectWorker(string project_code, string corp_code, string team_name, string idcard_number)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/project_worker/delete";

            string postData = JsonConvert.SerializeObject(new { project_code, corp_code, team_name, idcard_number });
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }


        /// <summary>
        /// 查询项目工人信息
        /// http://localhost:9609/api/1.0/project_worker/query?page_num=1&page_size=10&project_code=475000200706008652&corp_code=&team_name=&idcard_number=
        /// </summary>
        /// <param name="page_num">当前页码。从1开始</param>
        /// <param name="page_size">每页记录数，最多不能超过50</param>
        /// <param name="project_code">项目编码</param>
        /// <param name="corp_code">参建企业统一社会信用代码</param>
        /// <param name="team_name">班组名称</param>
        /// <param name="idcard_number">证件号码</param>
        public void GetProjectWorker(string page_num, string page_size, string project_code, string corp_code, string team_name, string idcard_number)
        {

            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/project_worker/query?page_num={page_num}&page_size={page_size}&project_code={project_code}&corp_code={corp_code}&team_name={team_name}&idcard_number={idcard_number}";
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Get(url));
            if (resutData.code != 200)
            {

            }
        }

        #endregion


        #region 工人进退场信息

        /// <summary>
        /// 上传项目工人进退场信息
        /// http://localhost:9609/api/1.0/worker_entry_exit/add
        /// </summary>
        /// <param name="project_code">项目编码</param>
        /// <param name="corp_code">参建企业统一社会信用代码</param>
        /// <param name="corp_name">参建企业名称</param>
        /// <param name="idcard_type">证件类型。参考数据字典：人员证件类型字典表</param>
        /// <param name="idcard_number">证件号码</param>
        /// <param name="date">	进退场日期，yyyy-MM-dd</param>
        /// <param name="type">类型。参考数据字典：工人进退场类型字典表</param>
        /// <returns></returns>
        public string AddWorkerEntryExit(string project_code, string corp_code, string corp_name, string idcard_type, string idcard_number, string date, int type)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/worker_entry_exit/add";

            string postData = JsonConvert.SerializeObject(new { project_code, corp_code, corp_name, idcard_type, idcard_number, date, type });
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// 更新项目中工人的进退场信息。
        /// http://localhost:9609/api/1.0/worker_entry_exit/update
        /// </summary>
        /// <returns></returns>
        public string UpdateWorkerEntryExit(UpdateWorkerEntryExitParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/worker_entry_exit/update";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// 删除项目工人进退场信息
        /// http://localhost:9609/api/1.0/worker_entry_exit/delete
        /// </summary>
        /// <param name="project_code"></param>
        /// <param name="corp_code"></param>
        /// <param name="team_name"></param>
        /// <param name="idcard_number"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public string DeleteWorkerEntryExit(string project_code, string corp_code, string team_name, string idcard_number, string date)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/worker_entry_exit/delete";

            string postData = JsonConvert.SerializeObject(new { project_code, corp_code, team_name, idcard_number, date });
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// 查询项目工人进退场信息
        /// http://localhost:9609/api/1.0/worker_entry_exit/query?page_num=1&page_size=5&project_code=475000200706008652&corp_code=&team_name=&idcard_number=
        /// </summary>
        /// <param name="page_num"></param>
        /// <param name="page_size"></param>
        /// <param name="project_code"></param>
        /// <param name="corp_code"></param>
        /// <param name="team_name"></param>
        /// <param name="idcard_number"></param>
        public void GetWorkerEntryExit(string page_num, string page_size, string project_code, string corp_code, string team_name, string idcard_number)
        {

            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/worker_entry_exit/query?page_num={page_num}&page_size={page_size}&project_code={project_code}&corp_code={corp_code}&team_name={team_name}&idcard_number={idcard_number}";
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Get(url));
            if (resutData.code != 200)
            {

            }
        }

        #endregion


        #region 工人合同信息

        /// <summary>
        /// http://localhost:9609/api/1.0/worker_contract/add
        /// 上传工人合同信息
        /// </summary>
        /// <param name="project_code"></param>
        /// <param name="corp_code"></param>
        /// <param name="corp_name"></param>
        /// <param name="idcard_type"></param>
        /// <param name="idcard_number"></param>
        /// <param name="date"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public string AddWorkerContract(AddWorkerContractParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/worker_contract/add";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// http://localhost:9609/api/1.0/worker_contract/update
        /// 修改工人合同信息
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public string UpdateWorkerContract(UpdateWorkerContractParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/worker_contract/update";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// http://localhost:9609/api/1.0/worker_contract/delete
        /// 删除工人合同信息
        /// </summary>
        /// <param name="id"></param>
        /// <param name="project_code"></param>
        /// <returns></returns>
        public string DeleteWorkerContract(string id, string project_code)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/worker_contract/delete";

            string postData = JsonConvert.SerializeObject(new { id, project_code });
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// 查询工人合同信息
        /// http://localhost:9609/api/1.0/worker_contract/query?page_num=1&page_size=5&project_code=475000200706008652&corp_code=&idcard_number=&contract_code=
        /// </summary>
        /// <param name="page_num"></param>
        /// <param name="page_size"></param>
        /// <param name="project_code"></param>
        /// <param name="corp_code"></param>
        /// <param name="idcard_number"></param>
        /// <param name="contract_code"></param>
        public void GetWorkerContract(string page_num, string page_size, string project_code, string corp_code, string idcard_number, string contract_code)
        {

            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/worker_contract/query?page_num={page_num}&page_size={page_size}&project_code={project_code}&corp_code={corp_code}&idcard_number={idcard_number}&contract_code={contract_code}";
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Get(url));
            if (resutData.code != 200)
            {

            }
        }

        #endregion
        #endregion


        #region 考勤信息相关接口

        /// <summary>
        /// http://localhost:9609/api/1.0/worker_attendance/add
        /// 上传工人考勤
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public string AddWorkerAttendance(AddWorkerAttendanceParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/worker_attendance/add";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// http://localhost:9609/api/1.0/worker_attendance/update
        /// 修改工人考勤
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public string UpdateWorkerAttendance(UpdateWorkerAttendanceParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/worker_attendance/update";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// http://localhost:9609/api/1.0/worker_attendance/delete
        /// 删除工人考勤
        /// </summary>
        /// <param name="id"></param>
        /// <param name="project_code"></param>
        /// <returns></returns>
        public string DeleteWorkerAttendance(string id, string project_code)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/worker_attendance/delete";

            string postData = JsonConvert.SerializeObject(new { id, project_code });
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// http://localhost:9609/api/1.0/worker_attendance/query?page_num=1&page_size=5&project_code=475000200706008652&corp_code=&team_name=&idcard_number=
        /// 查询工人考勤
        /// </summary>
        /// <param name="page_num"></param>
        /// <param name="page_size"></param>
        /// <param name="project_code"></param>
        /// <param name="corp_code"></param>
        /// <param name="idcard_number"></param>
        /// <param name="contract_code"></param>
        public void GetWorkerAttendance(string page_num, string page_size, string project_code, string corp_code, string team_name, string idcard_number)
        {

            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/worker_contract/query?page_num={page_num}&page_size={page_size}&project_code={project_code}&corp_code={corp_code}&team_name{team_name}&idcard_number={idcard_number}";
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Get(url));
            if (resutData.code != 200)
            {

            }
        }



        #endregion


        #region 工资信息相关接口

        #region 工资单

        /// <summary>
        /// http://localhost:9609/api/1.0/pay_roll/add
        /// 创建工资单
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public string AddPayRoll(AddPayRollParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/pay_roll/add";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// 修改工资单
        /// http://localhost:9609/api/1.0/pay_roll/update
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public string UpdatePayRoll(UpdatePayRollParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/pay_roll/add";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// http://localhost:9609/api/1.0/pay_roll/delete
        /// 删除工资单
        /// </summary>
        /// <param name="id"></param>
        /// <param name="project_code"></param>
        /// <returns></returns>
        public string DeletePayRoll(string id, string project_code)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/pay_roll/delete";

            string postData = JsonConvert.SerializeObject(new { id, project_code });
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// http://localhost:9609/api/1.0/pay_roll/query?page_num=1&page_size=5&project_code=475000200706008652&id=&pay_roll_code=&corp_code=&team_name=
        /// 查询工资单
        /// </summary>
        /// <param name="page_num"></param>
        /// <param name="page_size"></param>
        /// <param name="project_code"></param>
        /// <param name="corp_code"></param>
        /// <param name="team_name"></param>
        /// <param name="idcard_number"></param>
        public void GetPayRoll(string page_num, string page_size, string project_code, string id, string pay_roll_code, string corp_code, string team_name)
        {

            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/worker_contract/query?page_num={page_num}&page_size={page_size}&project_code={project_code}&id={id}&pay_roll_code={pay_roll_code}&corp_code={corp_code}&team_name{team_name}";
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Get(url));
            if (resutData.code != 200)
            {

            }
        }

        #endregion

        #region 工资单明细

        /// <summary>
        /// http://localhost:9609/api/1.0/pay_roll_detail/add
        /// 上传工资单明细
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public string AddPayRollDetail(AddPayRollDetailParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/pay_roll_detail/add";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// 修改工资单明细
        /// http://localhost:9609/api/1.0/pay_roll_detail/update
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public string UpdatePayRollDetail(UpdatePayRollDetailParam param)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/pay_roll_detail/update";

            string postData = JsonConvert.SerializeObject(param);
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// 删除工资单明细
        /// http://localhost:9609/api/1.0/pay_roll_detail/delete
        /// </summary>
        /// <param name="id"></param>
        /// <param name="project_code"></param>
        /// <returns></returns>
        public string DeletePayRollDetail(string id, string project_code, string corp_code, string pay_roll_code, string idcard_number)
        {
            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/pay_roll_detail/delete";

            string postData = JsonConvert.SerializeObject(new { id, project_code, corp_code, pay_roll_code, idcard_number });
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Post(url, postData));
            if (resutData.code != 200)
                return resutData.msg;
            else
                return resutData.msg;
        }

        /// <summary>
        /// 查询工资单明细
        /// http://localhost:9609/api/1.0/pay_roll_detail/query?page_num=1&page_size=10&project_code=475000200706008652&corp_code=&idcard_number=&pay_roll_code=&id=
        /// </summary>
        /// <param name="page_num"></param>
        /// <param name="page_size"></param>
        /// <param name="project_code"></param>
        /// <param name="id"></param>
        /// <param name="pay_roll_code"></param>
        /// <param name="corp_code"></param>
        /// <param name="team_name"></param>
        public void GetPayRollDetail(string page_num, string page_size, string project_code, string corp_code, string idcard_number, string pay_roll_code, string id)
        {

            string accessToken = ConfigEnvironment.Instance.KFLWYG_ACCESS_TOKEN;
            var url = $"{ConfigEnvironment.Instance.ServerHost}/api/1.0/pay_roll_detail/query?page_num={page_num}&page_size={page_size}&project_code={project_code}&corp_code={corp_code}&idcard_number{idcard_number}&pay_roll_code={pay_roll_code}&id={id}";
            ResultData resutData = JsonConvert.DeserializeObject<ResultData>(new WebApiHelper(accessToken).Get(url));
            if (resutData.code != 200)
            {

            }
        }
        #endregion

        #endregion

    }
}
